<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../../currency/layer.html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <script type="text/javascript">
    var userEdit ={
    	sumbit:function (){
    		_linwq_borderColor("uName");
    		_linwq_borderColor("uPhone");
    		_linwq_borderColor("uIdentity");
    		_linwq_borderColor("uEmail");
    		_linwq_borderColor("uRidBtn");
    		$("#msg").html('');
    		var param={
    				uId:'${user.uId}',
    				uName:$("#uName").val(),
    				uPhone:$("#uPhone").val(),
    				uIdentity:$("#uIdentity").val(),
    				uEmail:$("#uEmail").val(),
    				rId:$("#uRidBtn").val()
    		}
    		if(_linwq_trim(param.uName+"")==''){
    			_linwq_borderColor("uName","red");
    			$("#msg").html("用户名格式有误！");
    		}else if(_linwq_trim(param.uPhone+"")==''){
    			_linwq_borderColor("uPhone","red");
    			$("#msg").html("手机号码格式有误！");
    		}else if(_linwq_trim(param.uIdentity+"")==''){
    			_linwq_borderColor("uIdentity","red");
    			$("#msg").html("身份证格式有误！");
    		}else if(_linwq_trim(param.uEmail+"")==''){
    			_linwq_borderColor("uEmail","red");
    			$("#msg").html("邮箱格式有误！");
    		}else{
    			var msg ;
    			var msg1 ;
    			if(param.rId){
    				msg = "确认保存修改的用户信息？";//编辑
    				msg1 = "菜单信息修改成功";
    			}else{
    				msg = "确认新增改用户信息？";//新增
    				msg1 = "菜单信息添加成功";
    			}
    			_linwq_confirm(msg,"确认","取消",function(){
	    			_linwq_ajax("/user/userSave.action",param,'text',function(data){
		    			if(data=="success"){
		    				var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
		    				parent.layer.msg(msg1,{icon:1});
		    				parent.layer.close(index); //再执行关闭   
		    			}else{
		    				var index = layer.getFrameIndex(window.name);
		    				layer.close(index);
		    				layer.msg(data,{icon:2});
		    			}
		    		}); 
    			});
    		}
    	}
    }	
    
	</script>
			<div class="page-wrap">
			<!--开始::内容-->
				<section class="page-hd">
					<header>
						<h2 class="title">表单结构展示</h2>
						<p class="title-description">
							两列式表单结构，一般针对产品详情，文章详情应用。
						</p>
					</header>
					<hr>
				</section>
					<div class="form-group-col-2">
						<div class="form-label">用户名称：</div>
						<div class="form-cont">
							<input type="text" id="uName" placeholder="用户名称..." value="${user.uName }" class="form-control form-boxed">
						</div>
					</div>
					<div class="form-group-col-2">
						<div class="form-label">用户电话：</div>
						<div class="form-cont">
							<input type="text" id="uPhone" placeholder="用户电话..." value="${user.uPhone}" class="form-control form-boxed">
						</div>
					</div>
					<div class="form-group-col-2">
						<div class="form-label">身份证：</div>
						<div class="form-cont">
							<input type="text" id="uIdentity" placeholder="" value="${user.uIdentity }" class="form-control form-boxed">
						</div>
					</div>
					<div class="form-group-col-2">
						<div class="form-label">邮箱：</div>
						<div class="form-cont">
							<input type="text" id="uEmail" placeholder="" value="${user.uEmail}" class="form-control form-boxed">
						</div>
					</div>
					<div class="form-group-col-2">
						<div class="form-label">角色：</div>
						<div class="form-cont">
							<div class="btn-drop-group">
								<button id="uRidBtn" class="btn btn-secondary dropdown-toggle" value="${uRole.rId}">${uRole.rName}</button>
								<div class="drop-list" >
									<ul >
										<c:forEach items="${rList }" var="role">
											<li data-val="${role.rId}">${role.rName }</li>
										</c:forEach>
									</ul>
								</div>
							</div>
						</div>
					</div>
					<div class="form-group-col-2">
						<div class="form-label"></div>
						<div class="form-cont">
							<input type="button" class="btn btn-primary" value="提交表单" onclick="userEdit.sumbit()"/>
							<span style="color: red;" id="msg"></span>
						</div>
					</div>
				<!--开始::结束-->
			</div>
